<script type="text/javascript">
<!--
$(document).ready(function(){
	$("#sotien").keydown(function(e)
			{
					arr_key = new Array();
					arr_key[8]=8;
					arr_key[9]=9;
					arr_key[35]=35;
					arr_key[36]=36;
					arr_key[37]=37;
					arr_key[39]=39;
					arr_key[46]=46;
			        if ( arr_key[e.keyCode]!==undefined)
				    {}
			        else
			            if (e.keyCode < 48 || e.keyCode > 57 ) 
					        e.preventDefault();
			});
				
			$("#sotien").keyup(function()
			{
				$('#sotien').val(numberformat($('#sotien').val().replace(/[.]/g,'')));
			});
});
$(function(){
	$( "#ngaynop").datepicker( {
		showOtherMonths: true,
		selectOtherMonths: true,
		changeMonth: true,
		dateFormat: "dd-mm-yy",
		showOn: "both",
		buttonImage:$('#root').val()+"img/calendar.jpg",
		buttonImageOnly: true
			});
});
function validate()
{
	if($('#loaichiphi').val()=='')
	{
		alert('Bạn Chưa Chọn Loại Phí');
		return false;
	}
	if($('#sotien').val()=='')
	{
		alert('Bạn Chưa nhập số tiền');
		return false;
	}						
	if($('#ngaynop').val()=='')
	{
		alert('Bạn Chưa Chọn Ngày');
		return false;
	}
	if($('#nguoinhan').val()=='')
	{
		alert('Bạn Chưa nhập người nhận');
		return false;
	}
	return true;
}
//-->
</script>
<div class="phicdsvs form">
<?php echo $this->Form->create('Phicdcb',array('type'=>'post','onsubmit'=>'return validate()','url'=>array('controller'=>'phicdcbs','action'=>'edit',$chidoan_id,$id)));?>
	<fieldset>
		<legend><?php __('Sửa Thu(Chi)'); ?></legend>
	<?php
		echo $this->Form->input('id');
		echo $form->input('root',array('id'=>'root','type'=>'hidden','value'=>$this->webroot));
		echo $this->Form->input('loaichiphi_id',array('id'=>'loaichiphi','option'=>$loaichiphis,'label'=>'Loại Phí','empty'=>'Chọn loại phí'));
		echo $this->Form->input('ngaynop',array('id'=>'ngaynop','type'=>'text','label'=>'Ngày Thu(Chi)'));
		echo $this->Form->input('sotien',array('id'=>'sotien','label'=>'Số Tiền(VNĐ)'));
		echo $this->Form->input('lydo',array('id'=>'lydo','label'=>'Lý Do'));
		echo $this->Form->input('nguoinhan',array('id'=>'nguoinhan','label'=>'Người Nhận'));
		echo $this->Form->input('ghichu',array('id'=>'ghichu','label'=>'Ghi Chú'));
	?>
	</fieldset>
<?php echo $this->Form->end(__('  Lưu  ', true));?>
</div>
<div class="actions">
	<h3><?php __('Actions'); ?></h3>
	<ul>

		<li><?php echo $this->Html->link(__('Delete', true), array('action' => 'delete', $this->Form->value('Phicdcb.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $this->Form->value('Phicdcb.id'))); ?></li>
		<li><?php echo $this->Html->link(__('List Phicdcbs', true), array('action' => 'index'));?></li>
		<li><?php echo $this->Html->link(__('List Loaichiphis', true), array('controller' => 'loaichiphis', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Loaichiphi', true), array('controller' => 'loaichiphis', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Chidoansvs', true), array('controller' => 'chidoansvs', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Chidoansv', true), array('controller' => 'chidoansvs', 'action' => 'add')); ?> </li>
	</ul>
</div>